package basic;

public class VariableParameter1 {
    public void search(int element, int... elements){
        boolean existed = false;
        for (int e : elements) {
            if (e == element) {
                existed = true;
                break;
            }
        }
        if (existed){
            System.out.println("找到元素：" + element);
        }else {
            System.out.println("未找到元素：" + element);
        }
    }

    public static void main(String[] args) {

        VariableParameter1 obj = new VariableParameter1();
        obj.search(2,2,1,2,3,4);
        int[] arr = {1,2,3,4};
        obj.search(5,arr);
    }
}
